<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>文章内容列表-编辑文章</title>
    <link href="/zhenze/Public/admin/css/style.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="/zhenze/Public/admin/js/jquery.js"></script>
    <script type="text/javascript" src="/zhenze/Public/My97DatePicker/WdatePicker.js"></script>
    <link href="/zhenze/Public/validform/Validform.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/zhenze/Public/validform/Validform_v5.3.2.js"></script>
    <script type="text/javascript" src="/zhenze/Public/validform/Validform_Datatype.js"></script>

    <link href="/zhenze/Public/admin/css/select.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/zhenze/Public/admin/js/jquery.idTabs.min.js"></script>
    <script type="text/javascript" src="/zhenze/Public/admin/js/select-ui.min.js"></script>

    <link rel="stylesheet" href="/zhenze/Public/kindeditor/themes/default/default.css" />
    <script type="text/javascript" src="/zhenze/Public/kindeditor/kindeditor-min.js"></script>
    <script type="text/javascript" src="/zhenze/Public/kindeditor/lang/zh-CN.js"></script>

    <script type="text/javascript">
        var editor;
        KindEditor.ready(function(K) {
            editor = K.create('textarea[id="content"]', {
                        uploadJson : '<?php echo U('kindeditor/upload_json',array('dir'=>image));?>',
                    fileManagerJson : '<?php echo U('kindeditor/file_manager_json');?>',
                    allowFileManager : true,
                    urlType : 'domain',
                    afterCreate : function() {
                this.sync();
            },
            afterBlur:function(){
                this.sync();
            }
        });

            var uploadbutton = K.uploadbutton({
                        button : K('#uploadButton')[0],
                        fieldName : 'imgFile',
                        url : '<?php echo U('kindeditor/upload_json',array('dir'=>image));?>',
                    afterUpload : function(data) {
                if (data.error === 0) {
                    var url = K.formatUrl(data.url, 'domain');
                    K('#image').val(url);
                } else {
                    alert(data.message);
                }
            },
            afterError : function(str) {
                alert('自定义错误信息: ' + str);
            }
        });
            uploadbutton.fileBox.change(function(e) {
                uploadbutton.submit();
            });
        });
        $(document).ready(function(e) {
            $("#classtype").uedSelect({
                width : 150
            });
        });
    </script>
</head>

<body>

<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="<?php echo U('index/index');?>">首页</a></li>
        <li><a href="<?php echo U('content/index');?>">文章内容列表</a></li>
        <li><a href="#">编辑文章</a></li>
    </ul>
</div>

<div class="formbody">

    <div class="formtitle"><span>编辑文章</span></div>

    <form name="myform" id="myform" action="<?php echo U('Eventinfo/addSubmit');?>" method="post">
        <ul class="forminfo">
            <li><label>活动标题</label><input name="info[event_title]" id="title" type="text" class="dfinput" datatype="*" errormsg="标题不能为空！" maxlength="50"  /><i class="Validform_checktip"></i></li>
            <li><label>起始时间</label><input placeholder="起始时间" name="info[event_starttime]" id="starttime" class="scinput" type="text" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd '})" datatype="*" errormsg="时间范围开始值不能为空！" maxlength="20" style="width: 100px;" readonly value="<?=I('start_time')?>" /></li>
            <li><label>截止时间</label><input placeholder="截止时间" name="info[event_endtime]" id="endtime" class="scinput" type="text" onfocus="WdatePicker({dateFmt: 'yyyy-MM-dd'})" datatype="*" errormsg="时间范围结束值范围不能为空！" maxlength="20" style="width: 100px;" readonly value="<?=I('end_time')?>" /></li>
            <li><label>活动图片</label><input name="info[event_image]" id="image" type="text" class="dfinput" readonly/>&nbsp;<input type="button" id="uploadButton" value="上传" /><i class="Validform_checktip"></i></li>
            <li><label>所属商家</label>
                <div class="vocation">
                    <select id="classtype" name="info[classtype]" datatype="*" errormsg="角色不能为空！" onchange="showschool(this.value);">
                        <option value="">选择商家</option>
                        <?php if(is_array($roleName)): foreach($roleName as $k=>$v): ?><option value="<?php echo ($v["admin_id"]); ?>"><?php echo ($v["username"]); ?></option><?php endforeach; endif; ?>
                    </select>
                </div>
                <i class="Validform_checktip"></i>
            </li>
            <li><label>活动内容</label><textarea name="info[event_content]" id="content" cols="" rows="" class="textinput" style="height: 250px;width:700px;"><?php echo ($EventInfo["event_content"]); ?></textarea></li>
            <li><label>&nbsp;</label><input name="btn" type="submit" class="btn" value="确认保存"/></li>
        </ul>
    </form>

</div>

<script>
    $(function(){
        $("#myform").Validform({
            //tiptype:2
            tiptype:function(msg,o,cssctl){
                var objtip=o.obj.siblings(".Validform_checktip");
                cssctl(objtip,o.type);
                objtip.text(msg);
            }
        });
    });
</script>
</body>

</html>